package day1;

import java.util.Scanner;

public class Day1_01 {
    public static void main(String[] args) {
        //输入
        Scanner in = new Scanner(System.in);
        int first = in.nextInt();
        int last = in.nextInt();

        int ret = 0;
        for(int i = first; i <= last; i++) {
            ret += count(i);
        }

        System.out.println(ret);
    }
    //记录数中2个数
    private static int count(int num) {
        int ret = 0;
        while(num > 0) {
            if(num % 10 == 2) ret++;
            num = num / 10;
        }
        return ret;
    }
}

//https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpId=290&tqId=39941&ru=/exam/oj